<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>晒单</title>       
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no, maximum-scale=1.0"/>
<meta content="yes" name="apple-mobile-web-app-capable" />     
<meta content="black" name="apple-mobile-web-app-status-bar-style" />     
<meta content="telephone=no" name="format-detection" />
<link href="../assets/mobile/comm.css" rel="stylesheet" type="text/css" />
<link href="../assets/mobile/single.css?" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../assets/mobile/top.css">
<link rel="stylesheet" href="../assets/agile/css/ratchet/css/ratchet.min.css">
<link rel="stylesheet" href="../assets/agile/css/flat/flat.component.css">
<link rel="stylesheet" href="../assets/agile/css/flat/iconline.css">
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/jquery.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/local.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
</head>
<body style="position:static;">
<div class="h5-1yyg-v1">

<!--通用顶部-->
<div id="ios-top-box">
	<div id="header" class="bar bar-nav">
	<div class="titlebar">
	<a href="javascript:appClose('shaidan',api);"><i class="iconfont iconline-arrow-left"></i></a>
	<h1 class="title">晒单</h1>
	</div>
	</div>
</div>
<!--通用顶部结束-->

<!-- 内页顶部 -->

    <div style="position:static;margin-top:64px;">
    <div id="navBox" class="g-snav m_listNav">
        <div class="g-snav-lst z-sgl-crt"><a href="javascript:;" class="gray9">最新晒单</a><b></b></div>
        <div class="g-snav-lst"><a href="javascript:;" class="gray9">人气晒单</a><b></b></div>
        <div class="g-snav-lst"><a href="javascript:;" class="gray9">评论最多</a></div>
    </div>


    <!-- 晒单列表 -->
    <section style="margin-top:0px !important;">	
		<div class="cSingleCon" id="loadingPicBlock">
		    <div id="postBox10" class="cSingleCon2"></div>
        </div>
		<div id="postLoading" class="loading loading2"><b class="loading-img"></b>正在加载</div>
        <a id="btnLoadMore" class="loading" href="javascript:;" style="display:none;">点击加载更多</a>
		<a id="btnLoadMore2" class="loading"  style="display:none;">没有数据</a>
        <a id="btnLoadMore3" class="loading"  style="display:none;">已经到底了</a>
    </section>
	</div>
	<input id="urladdress" value="" type="hidden" />
    <input id="pagenum" value="" type="hidden" />
</div>
</body>

<script type="text/javascript">
apiready = function(){
	$(function(){
		sdajax('new');
		
		function sdajax(parm){
			$("#urladdress").val('');
			$("#pagenum").val('');
			GetJPData(config.url + '/app.php?act=shaidan&type=' + parm, {}, function(data){
				$("#postLoading").hide();
				if (data[0].sum) {
					var fg = parm.split("/");
					$("#urladdress").val(fg[0]);
					$("#pagenum").val(data[0].page);
					for (var i = 0; i < data.length; i++) {
						var pic = data[i].sd_photolist.split(";");
						var t = new Date(data[i].sd_time);
						var div = '<div class="cSingleInfo"><dl class="fl">';
						div += '<a class="userindex" href="javascript:openItem(\'userindex\',' + data[i].sd_userid + ',function(id){localData.set(\'userid\',id);});" id="' + data[i].sd_userid + '">';
						div += '<img class="lazy" data-original="' + config.upload_url + '/' + data[i].pic + '">';
						div += '<b></b></a></dl><div class="cSingleR m-round">';
						div += '<ul><li><em class="blue" onclick="javascript:openItem(\'userindex\',' + data[i].sd_userid + ',function(id){localData.set(\'userid\',id);});" sd_userid="' + data[i].sd_userid + '">' + data[i].user + '</em>';
						div += '<span onclick="javascript:openItem(\'sddetail\',' + data[i].sd_id + ',function(id){localData.set(\'sd_id\',id);});"><strong class="c9">：</strong>' + data[i].sd_title + '</span> ';
						div += '<h5>' + data[i].time + '</h5></li>';
						div += '<li onclick="javascript:openItem(\'sddetail\',' + data[i].sd_id + ',function(id){localData.set(\'sd_id\',id);});"><p>' + data[i].sd_content + '</p></li>';
						div += '<li class="maxImg"  id="' + data[i].sd_id + '">';
						for (var x = 0; x < pic.length - 1; x++) {
							div += '<img class="lazy" onclick="javascript:openItem(\'sddetail\',' + data[i].sd_id + ',function(id){localData.set(\'sd_id\',id);});" data-original="' + config.upload_url + '/' + pic[x] + '">';
						}
						div += '</li>';
						div += '<li><dd><s></s><strong>' + data[i].sd_zhan + '</strong>人羡慕嫉妒</dd>';
						div += '<dd><i></i><strong>' + data[i].sd_ping + '</strong>条评论</dd>';
						div += '</li></ul><b class="z-arrow"></b></div></div>';
						$(".cSingleCon2").append(div);
						lyzimg();
					}
					if (data[0].page <= data[0].sum) {
						$("#btnLoadMore").css('display', 'block');
						$("#btnLoadMore2").css('display', 'none');
						$("#btnLoadMore3").css('display', 'none');
					}
					else 
						if (data[0].page > data[0].sum) {
							$("#btnLoadMore").css('display', 'none');
							$("#btnLoadMore2").css('display', 'none');
							$("#btnLoadMore3").css('display', 'block');
						}
				}
				else {
					$("#btnLoadMore").css('display', 'none');
					$("#btnLoadMore2").css('display', 'block');
					$("#btnLoadMore3").css('display', 'none');
				}
			})
		}
		
		$("#navBox div").click(function(){
			$(".cSingleCon2 div").remove();
			e = $(this).index();
			$("#navBox div").removeClass('z-sgl-crt').eq(e).addClass('z-sgl-crt');
			switch (e) {
				case 0:
					sdajax('new');
					break;
				case 1:
					sdajax('renqi');
					break;
				case 2:
					sdajax('pinglun');
					break;
			}
		});
		//加载更多
		$("#btnLoadMore").click(function(){
			var url = $("#urladdress").val(), page = $("#pagenum").val();
			sdajax(url + '&p=' + page);
		});
		//返回顶部
		$(window).scroll(function(){
			if ($(window).scrollTop() > 50) {
				$("#btnTop").show();
			}
			else {
				$("#btnTop").hide();
			}
		});
		$("#btnTop").click(function(){
			$("body").animate({
				scrollTop: 0
			}, 10);
		});
		
		//跳转页面
	
		/**
		 var gt='.cSingleInfo .maxImg';
		 $('body').on('click',gt,function(){
		 var id=$(this).attr('id');
		 alert(id);
		 if(id){
		 openItem('sddetail',id,function(id){
		 localData.set('sd_id',id);
		 });
		 }
		 });
		 $('body').on('click','.cSingleInfo .blue',function(){
		 var id=$(this).attr('id');
		 alert('use'+id);
		 if(id){
		 openItem('userindex',id,function(id){
		 localData.set('userid',id);
		 });
		 }
		 });
		 
		 */
	});
}
</script>
</html>